package com.saibo.spider.gather.service;

import java.net.InetAddress;
import java.util.HashMap;
import java.util.Map;

import com.alibaba.fastjson.JSON;
import com.saibo.spider.commons.ConnectServer;
import com.saibo.spider.utils.HttpRequestUtil;

public class CrawlerRegister {
	public static String crawlerRegister(){
		String url = "http://192.168.1.167:8081/services/schedule/register";
		Map<String,String> param = new HashMap<String,String>();
		InetAddress ia;
		try {
			ia = InetAddress.getLocalHost();
			param.put("macaddr", HttpRequestUtil.getLocalMac(ia));
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		String responseValue = ConnectServer.sendPostRequest(url, JSON.toJSONString(param));
		System.out.println(responseValue);
		return responseValue;
	}
	
	public static void main(String[] args) {
		CrawlerRegister.crawlerRegister();
	}
	
}
